<template>
    <div class="ec-app-container">
        <!-- 查询条件 -->
        <div class="filter-container">
            <el-form label-width="90px">
                <el-row :gutter="10">
                    <el-col :span="6">
                        <el-form-item label="楼旁名称：" >
                            <el-input v-model="listQuery.title" placeholder="姓名"/>
                        </el-form-item>
                    </el-col>
                    <el-col :span="6">
                        <el-form-item label="城市：" >
                            <el-input v-model="listQuery.title" placeholder="账号"/>
                        </el-form-item>
                    </el-col>
                    <el-col :span="6">
                        <el-form-item label="楼旁状态：" >
                            <el-select v-model="listQuery.title" placeholder="用户状态" clearable>
                                <el-option v-for="(item, index) in buildingStatus" :label= "item" :value="index+1"/>
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :span="6" class="text-center">
                        <el-button type="" class="border-4C7FD7 color-4C7FD7" icon="el-icon-search" @click="searchList">查询</el-button>
                        <el-button class="border-4C7FD7 color-4C7FD7" @click="resetSearch">重置</el-button>
                    </el-col>
                </el-row>
            </el-form>
        </div>
        <!-- table -->
        <div>
            <div class="mt-30">
                <!--<el-button class="filter-item" type="primary" @click="searchList">待发布</el-button>-->
                <!--<el-button class="filter-item" type="primary" @click="searchList"></el-button>-->
                <!--<el-button class="filter-item" type="primary" @click="searchList">批量下架</el-button>-->
                <el-button class="filter-item" type="primary" @click="addBuilding">新增</el-button>
                <el-button class="filter-item" type="primary" @click="exprotBuilding">导出</el-button>
            </div>
            <div class="mt-20">
                <el-table
                        v-loading="listLoading"
                        :data="list"
                        border
                        fit
                        highlight-current-row
                        @selection-change="handleSelectionChange"
                        style="width: 100%;">
                    <el-table-column
                            type="selection"
                            width="55"/>
                    <el-table-column label="操作" align="center" width="230" class-name="small-padding fixed-width">
                        <template slot-scope="scope">
                            <el-button type="primary" size="mini" @click="handleUpdate(scope.row)">发布</el-button>
                            <el-button type="primary" size="mini" @click="handleUpdate(scope.row)">编辑</el-button>
                            <el-button type="primary" size="mini" @click="handleUpdate(scope.row)">删除</el-button>
                            <el-button type="primary" size="mini" @click="handleUpdate(scope.row)">查看</el-button>
                            <el-button type="primary" size="mini" @click="handleUpdate(scope.row)">撤销</el-button>
                        </template>
                    </el-table-column>
                    <el-table-column label="楼盘名称" prop="id" align="center">
                        <template slot-scope="scope">
                            <span>{{ scope.row.buildingName }}</span>
                        </template>
                    </el-table-column>
                    <el-table-column label="城市" prop="id" align="center">
                        <template slot-scope="scope">
                            <span>{{ scope.row.cityName }}</span>
                        </template>
                    </el-table-column>
                    <el-table-column label="楼旁状态" prop="id" align="center">
                        <template slot-scope="scope">
                            <span>{{ scope.row.buildingStatus }}</span>
                        </template>
                    </el-table-column>
                    <el-table-column label="物业公司" prop="id" align="center">
                        <template slot-scope="scope">
                            <span>{{ scope.row.id }}</span>
                        </template>
                    </el-table-column>
                    <el-table-column label="创建人" prop="id" align="center">
                        <template slot-scope="scope">
                            <span>{{ scope.row.id }}</span>
                        </template>
                    </el-table-column>
                    <el-table-column label="创建时间" prop="id" align="center">
                        <template slot-scope="scope">
                            <span>{{ scope.row.id }}</span>
                        </template>
                    </el-table-column>
                    <el-table-column label="发布状态" prop="id" align="center">
                        <template slot-scope="scope">
                            <span>{{ scope.row.id }}</span>
                        </template>
                    </el-table-column>
                </el-table>
            </div>
            <pagination v-show="total>0" :total="total" :page.sync="listQuery.pageNum" :limit.sync="listQuery.pageSize" @pagination="searchList" />
        </div>
    </div>
</template>

<script>
    import Pagination from '@/components/Pagination' // Secondary package based on el-pagination、
    import { mixin } from '@/common/mixins/mixin'
    import common from '@/api/common'
    export default {
        name: 'Project',
        components: {
            Pagination
        },
        mixins: [mixin],
        data() {
            return {
                listLoading: false,
                total: 0,
                listQuery: {
                    title: '',
                    pageSize: 10,
                    pageNum: 1
                },
                list: [],
                buildingStatus:common.buildingStatus,

                multipleSelection: []
            }
        },
        created() {

        },
        methods: {
            getList() {
                alert('查询')
            },
            searchList() {
                alert('搜索')
            },
            // 新增楼盘
            addBuilding() {
                this.$router.push('/project/createbuilding')
            },
            // 楼盘详情
            detailBuilding() {
                this.$router.push('/')
            },
            // 选择复选框
            handleSelectionChange(val) {
                this.multipleSelection = val
                // this.userIds = _.map(this.multipleSelection, 'userId')
            },
            // 导出
            exportBuilding() {
                // this.downloadLoading = true
                // import('@/vendor/Export2Excel').then(excel => {
                //     const tHeader = ['timestamp', 'title', 'type', 'importance', 'status']
                //     const filterVal = ['timestamp', 'title', 'type', 'importance', 'status']
                //     const data = this.formatJson(filterVal, this.list)
                //     excel.export_json_to_excel({
                //         header: tHeader,
                //         data,
                //         filename: 'table-list'
                //     })
                //     this.downloadLoading = false
                // })
            }
        }
    }
</script>

<style scoped>

</style>